<template>
  <div class="articleStore-page">
    <GhNavBar title="收藏中心"  />
    <div class="content">
      <van-empty style="margin-top: 120px;" v-if="FavoriteList.length===0"  description="暂无收藏的文章" />
      <div v-else> 
        <div class="content"  >
            <Item  v-for="item in FavoriteList" :key="FavoriteList.id" :data="item"  />
        </div>
        
     </div>

    </div>
  </div>
</template>

<script setup>
import {ref,reactive,toRefs,onBeforeMount,onMounted} from "vue"
import{useRouter}from 'vue-router'
const router =useRouter();  
import { Toast, Dialog } from 'vant';
import 'vant/es/toast/style'
import Item from '../../Article/components/Item.vue'
import {articleStore,getAllArticle} from '@/services/article'
import{getconsultantInfoByName,getuseridByaccount} from '@/services/others'
import{formatTime}from '@/utils/util'
import GhNavBar from '@/components/gh-nav-bar.vue'
 // 定义数据
 const today = ref(null);
 //我的收藏列表数据
const FavoriteList = ref([]);
//用户的id数据
const userId=ref('')


//组件挂载之前加载列表的数据
onBeforeMount(async()=>{
    const account=JSON.parse(localStorage.getItem('gh-user')).user.userData.account
    const user_id=await getuseridByaccount(account)
     userId.value=user_id.data.id
     const res=await articleStore(userId.value)
    //  console.log(res.data)
     FavoriteList.value=res.data
})




</script>

<style lang="scss" scoped>
.articleStore-page{
      width: 100%;
      .content{
          width: 100%;
          margin-top: 40px;
          padding: 0 10px;

      }


}
</style>
